import Mock from './mock.mp'

Mock.mock('https://api-hmugo-web.itheima.net/api/public/v1/users/wxlogin', 'post', function (options) {
  return { "message": { "user_id": 394, "user_email_code": null, "is_active": null, "user_sex": "男", "user_qq": "", "user_tel": "", "user_xueli": "本科", "user_hobby": "", "user_introduce": null, "create_time": 1676469467, "update_time": 1676469467, "token": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjM5NCwiaWF0IjoxNjc5OTcyMjU3LCJleHAiOjEwMDE2Nzk5NzIyNTZ9.oA2ceuUiRjgH5hV0hD1PlyoVFS5-ZPPlR28OPD35bz4" }, "meta": { "msg": "登录成功", "status": 200 } }
})

Mock.mock('https://api-hmugo-web.itheima.net/api/public/v1/my/orders/create', 'post', function (options) {
  return { "message": { "order_id": 41975, "user_id": 394, "order_number": "HMDD20230328000000041975", "order_price": 0.1, "order_pay": "0", "is_send": "否", "trade_no": "", "order_fapiao_title": "个人", "order_fapiao_company": "", "order_fapiao_content": "", "consignee_addr": "四川省成都市金牛区xxx小区", "pay_status": "0", "create_time": 1679976676, "update_time": 1679976676, "order_detail": null, "goods": [{ "id": 104290, "order_id": 41975, "goods_id": 1, "goods_price": 0.1, "goods_number": 1, "goods_total_price": 0.1 }] }, "meta": { "msg": "创建订单成功", "status": 200 } }
})

Mock.mock('https://api-hmugo-web.itheima.net/api/public/v1/my/orders/req_unifiedorder', 'post', function (options) {
  return { "message": { "pay": { "timeStamp": "1679985869", "nonceStr": "ZIVC9tluiXCYGR7Y", "package": "prepay_id=wx28144427927540c574127c98e30fa90000", "signType": "MD5", "paySign": "E6EC15A72EF23339CF3E03053DA71E89" }, "order_number": "HMDD20230328000000041992" }, "meta": { "msg": "预付订单生成成功", "status": 200 } }
})
Mock.mock('https://api-hmugo-web.itheima.net/api/public/v1/my/orders/chkOrder', 'post', function (options) {
  return { "message": "支付成功", "meta": { "msg": "验证成功", "status": 200 } }
})
Object.defineProperty(wx, 'requestPayment', {
  writable: true
})

wx.requestPayment = function () {
  return new Promise((resolve, reject) => {
    setTimeout(() => {
      resolve()
    }, 1000)
  })
}